package com.ncmmall.domain.business.goods.subject;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.sql.Timestamp;
import java.util.List;

/**
 * @author likaikai
 * @date 2019-07-16 15:34
 */
@Entity
@Table(name = "mall_subject")
@Access(AccessType.FIELD)
@Getter
@Setter
public class Subject {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    /**
     * 排序值
     */
    private int rank = 50;

    /**
     * 专题名称
     */
    private String name;

    /**
     * 状态
     * 1、下架
     * 2、上架
     */
    private int status;

    /**
     * 商品数量
     */
    private int goodsNunber;

    /**
     * 专题商品列表
     */
    @OneToMany(fetch = FetchType.EAGER)
    @JoinColumn(name = "subjectId")
    private List<GoodsSubject> goodsSubjects;

    /**
     * 创建时间
     */
    private Timestamp createTime;

    /**
     * 0、用户商城端
     * 1、商家采购端
     */
    private int platformType;


}
